package baseObject;

public class Paddle extends RectObj implements IPaddle {

	public Paddle(int x, int y, int width, int height) {
		super(x, y, width, height);
	}

	@Override
	public void left() {
		if(this.getX() > 0)
			this.setCoord(this.getX() - 10, this.getY());
	}

	@Override
	public void right() {
		if(this.getX() + this.getWidth() < IBrickBreaker.XMAX)
			this.setCoord(this.getX() + 10, this.getY());
	}
	
/*	public Object clone() {
	    Paddle p = null;
	    try {
	      	p = (Paddle) super.clone();
	    } catch(CloneNotSupportedException cnse) {
	      	cnse.printStackTrace(System.err);
	    }
	    
	    return p;
	}
*/
	@Override
	public Object cloneObj() {
		return new Paddle(this.getX(), this.getY(), this.getWidth(), this.getHeight());
	}
}
